package com.yanmaohu.nikita.data;

import java.io.File;
import java.util.List;

/**
 * @author Bright Lee
 */
public final class TypeList {

    private final File file;
    private final UseList useList;
    private final List<Type> typeList;

    public TypeList(File file, UseList useList, List<Type> typeList) {
        this.file = file;
        if (useList != null && useList.isEmpty()) {
            useList = null;
        }
        this.useList = useList;
        if (typeList != null && typeList.isEmpty()) {
            typeList = null;
        }
        this.typeList = typeList;
    }

    public File getFile() {
        return file;
    }

    public UseList getUseList() {
        return useList;
    }

    public boolean isEmpty() {
        return typeList == null || typeList.isEmpty();
    }

    public int size() {
        if (isEmpty()) {
            return 0;
        }
        return typeList.size();
    }

    public Type get(int index) {
        if (isEmpty()) {
            return null;
        }
        return typeList.get(index);
    }

}
